<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!doctype html>
<html>
	<head>
		<title>用户登录</title>
		<meta charset="utf-8">
		<%@ include file="/WEB-INF/views/include/head.jsp"%>
		<script type="text/javascript">
			$(document).ready(function() {
				var m = decodeURI(getQueryString2("successUrl"))
				if(m != 'null'){	
					$("#successUrl").val(m);
				}
				if("${error}"!=''){
					alertx("${error}");
					$("#username").val("${username}");
					$("#password").val("${password}");
				}
				
				var remember = cookie("rememberit");
				if(remember != null){
					if(remember == 1){
						$("#rememberit").attr("checked",'true')
						if(cookie("username") != null){
							$("#username").val(cookie("username"));
						}						
					}
					else{
						$("#rememberit").removeAttr("checked");
					}
				}
				
				$(".dl_btn").click(function() {
					if($("#username").val()==''){
						$.jBox.tip('请输入用户名', 'error');
						return false;
					}
					if($("#password").val()==''){
						$.jBox.tip('请输入密码', 'error');
						return false;
					}
					if($("#rememberit").attr("checked")){
						cookie("username", $("#username").val());
					}
					$("#loginForm").submit();
				});
				
				$("#rememberit").click(function(){
					if ($("#rememberit").attr("checked")){					
						cookie("rememberit", 1);
					}
					else{						
						cookie("rememberit", 0);
					}
				});
			});
		</script>
	</head>
<body>
<div class="titlebox">
	<h2 class="tit_logo"></h2>
    <div class="tit_img"></div>
</div>
<div class="denglubox">
	<img src="${ctxStatic }/images/login_04.jpg"></img>
    <div class="loginbox">
    	<h2>Hi，欢迎登录！</h2>
    	<form id="loginForm" action="${ctx }/dologin" method="post">
        <div class="login_content">
        	<input class="username" name="username" id="username" type="text" placeholder="请输入用户名"/>
            <input class="userpass" name="password" id="password" type="password" />
            <input type="hidden" name="successUrl" id="successUrl"/>
        	<div class="checkbox clearfix">
        		<input type="checkbox" id="rememberit"/>
            	<label>记住登录名</label>
        	</div>
            <a class="dl_btn" href="javascript:;">立即登录</a>
        </div>
        </form>  
    </div>
</div>
<%@ include file="/WEB-INF/views/layouts/footer.jsp"%>
</body>
</html>